<%@ page import="java.util.Date" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="/page/share/taglib.jsp" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>血液制品信息报废</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <script language="JavaScript" type="text/javascript">
        function topage(page) {
            var form = document.getElementById("myform");
            document.getElementById("page")
                    .setAttribute("value", page);
            form.submit();
        }

        function actionEvent() {
            var form = document.getElementById("myform");
            if (ValidateIsSelect(form.all, form.bloodBankIds)) {
                form.action = "BloodBank!overdue.action";
                form.submit();
            } else {
                alert("请选择要操作的记录");
            }

        }
        /*
         *全选
         */
        function allselect(allobj, items) {
            var state = allobj.checked;
            if (items.length > 0) {
                for (var i = 0; i < items.length; i++) {
                    if (!items[i].disabled) {
                        items[i].checked = state;
                    }
                }
            } else {
                if (!items.disabled)items.checked = state;
            }
        }

        /*
         *判断是否选择了记录
         */
        function ValidateIsSelect(allobj, items) {
            if (items.length > 0) {
                for (var i = 0; i < items.length; i++) {
                    if (items[i].checked) {
                        return true;
                    }
                }
            } else {
                if (items.checked)return true;
            }
            return false;
        }
    </script>
    <style type="text/css">
        .a {
            text-decoration: none;
            font-family: '微软雅黑', serif;
            display: block;
            width: 200px;
            height: 30px;
            cursor: pointer;
            border: none;
            background: #114a93;
            color: white;
            font-size: 16px;
            padding: 4px 20px 0 20px;
            margin: 2px auto;
        }
    </style>
</head>

<body style="background:url(<%=basePath%>/background.jpg) repeat-x 40px -40px">
<span style="font-family: '微软雅黑',serif;font-size: 30px">血液制品信息报废</span>
<hr/>
<div style="float:left;margin: 120px 0 0 0;">
<a href="<%=basePath%>BloodBank!loadAllBlood.action" class="a" onMouseOver="this.style.background='#2569c1'"
   onmouseout="this.style.background='#114a93'">血液制品信息</a></div>

<form action="BloodBank!loadAllBlood.action" method="post" id="myform">
    <input type="hidden" value="overdue" name="redirect">
    <table style="margin: 120px auto 20px auto;background: #114a93;
    opacity:0.9;font-family: '微软雅黑',serif;color: linen;width:
    1000px;">
        <tr>
            <td colspan="11" bgcolor="gray" align="right">
                <%@ include file="/page/share/fenye.jsp" %>
            </td>
        </tr>
        <tr>
            <td><label>
                <input type="checkbox" name="all" onclick="allselect(this,this.form.bloodBankIds)">
            </label></td>
            <td>血型</td>
            <td>品种</td>
            <td>献血量</td>
            <td>献血时间</td>
            <td>采血单位</td>
            <td>献血人</td>
            <td>采血人</td>
            <td>到期时间</td>
            <td>状态</td>
            <td>报废原因</td>

        </tr>
        <s:iterator value="pageView.records" var="bloodBank">
            <tr>
                <td><label>
                    <s:if test="#bloodBank.state==1">
                        <input type="checkbox" value="${bloodBank.bloodBankId}" name="bloodBankIds">
                    </s:if>
                </label></td>
                <td>${bloodBank.bloodType.bloodType}</td>
                <td>${bloodBank.bloodName.bloodName}</td>
                <td>${bloodBank.bloodVolume}</td>
                <td>${bloodBank.bloodDate}</td>
                <td>${bloodBank.department}</td>
                <td>${bloodBank.bloodPerson}</td>
                <td>${bloodBank.bloodCollection}</td>

                <s:if test="#bloodBank.overdue<=">
                    <td bgcolor="red">${bloodBank.overdue}</td>
                </s:if>
                <s:else>
                    <td>${bloodBank.overdue}</td>
                </s:else>
                <td>
                    <s:if test="#bloodBank.state==0">
                        未审核
                    </s:if>
                    <s:elseif test="#bloodBank.state==1">
                        未使用
                    </s:elseif>
                    <s:elseif test="#bloodBank.state==2">
                        已使用
                    </s:elseif>
                    <s:else>
                        已报废
                    </s:else>
                </td>
                <td>
                    <s:if test="#bloodBank.state==3">
                        ${bloodBank.message}
                    </s:if>
                    <s:else>
                        <select name="messages">
                            <option value="血液过期">血液过期</option>
                            <option value="血液变质">血液变质</option>
                            <option value="血液丢失">血液丢失</option>
                            <option value="血液量有误">血液量有误</option>
                        </select>
                    </s:else>

                </td>
            </tr>
        </s:iterator>
    </table>
    <input type="button" name="overdue" onclick="actionEvent()" value="报废"  onMouseOver="this.style.background='#2569c1'"
           onmouseout="this.style.background='#114a93'"
           style="width:200px;height:30px;margin:6px 0 0 600px ;cursor:pointer;border: none;
           background: #114a93;color: white;font-size: 16px;">
</form>

</body>
</html>
